<?php
function js_script($src){
	if (is_array($src)){
		$result = "";
		foreach($src as $chunk){
			$result .= js_script($chunk);
		}
		return $result;
	}
	else{
		return "<script type=\"text/javascript\" src=\"". site_url(array('js', $src.'.js')) ."\"></script>";
	}
}

function js_script_text($js){
	return "<script type=\"text/javascript\">$js</script>";
}

function css_script($href, $rel="stylesheet"){
	if (is_array($href)){
		$result="";
		$rel_chunk ="";
		$i = 0;
		foreach($href as $chunk){
			if (is_array($rel)){
				$rel_chunk = $rel[$i++];
			}
			else{
				$rel_chunk = $rel;
			} 
			$result .= ($result? "\n" : "").css_script($chunk, $rel_chunk); 
		}
		return $result;
	}
	else{
		return "<link rel=\"$rel\" type=\"text/css\" href=\"". site_url(array('css', $href.'.css')) ."\" />";
	}
}